package pcloud.client.util;

import java.util.Collection;

public class Tree
{
	public Tree (TreeNode root)
	{
		this.root = root;
	}
	
	public void traverse()
	{
		traverse(root);
	}
	
	public static void traverse(TreeNode startNode)
	{
		startNode.visit();
		
		if (startNode.isLeaf()){
			return;
		}
		
		Collection <TreeNode> childNodes = startNode.getChildNodes();
		for (TreeNode childNode : childNodes)
		{
			traverse(childNode);
		}
	}
	
	private TreeNode root;
}
